<#import "/lib/composition.ftl" as ui />
<#import "/lib/spring.ftl" as spring />
<#import "/lib/cb.ftl" as cb />

<@ui.composition "/base.ftl">
  <#assign title in ui>
    ${gun.name} - ссылки на обзоры и отзывы.
  </#assign>

  <#assign content in ui>
    <section id="home" data-type="page" data-name="home" style="padding-top:0px;padding-bottom:0px;">                
      <div id="background"></div>      
      <div class="container">    
        <div style="color: white;"><a style="color: white;" href="<@spring.url '/' />">Все пистолеты</a>&nbsp;>&nbsp;${gun.name}</div>              
        <div id="featurebox" class="row-fluid">
          <div>&nbsp;</div>                  
          <div class="span11" style="height: 800px;">
            <table class="table">                
              <tr>
                <td style="width: 320px; border-width: 0px;">
                  <a href="${gun.shopLink}&${partnerKey}" target="_blank">
                    <img src="<@spring.url '/attachment/${gun.docId}/avatar' />" alt="" style="width:300px;" class="img-polaroid" />
                  </a>                    
                </td>                  
                <td style="border-width: 0px;">
                  <div class="row" style="margin-left:0px;margin-bottom: 0px;">
                    <div class="span9">
                      <h4 style="margin-top:0px; margin-bottom: 0px;"><a href="${gun.shopLink}&${partnerKey}" target="_blank">${gun.name}</a></h4>
                    </div>
                    <div class="span3">
                      <h4 style="margin-top:0px; margin-bottom: 0px;">${gun.price}&nbsp; руб.</h4>
                    </div>
                  </div>
                  
                  <hr style="margin-top: 0px;margin-bottom: 0px;" />
                  
                  <h5>
                    <table>
                      <@cb.score "Реалистичность" gun.realisticScore />                        
                      <@cb.score "Точность" gun.accuracyScore />
                      <@cb.score "Мощность" gun.powerScore />
                      <tr>
                        <td colspan="2" style="border-width:0px;padding-left:0px;font-size:12px;">
                          <hr style="margin-top: 5px;margin-bottom: 5px;" />
                          ${gun.description}
                        </td>
                      </tr>
                    </table>
                    
                    <div id="vk_like" style="margin-top: 10px;"></div>
                    <script type="text/javascript">
                      VK.Widgets.Like("vk_like", {type: "full"}, 4);
                    </script>
                  </h5>
                </td>
              </tr>              
            </table>
            
            <#if securityService.currentPrincipal == 'admin'>
              <a href="<@spring.url '/admin/edit/${gun.docId}' />">Редактировать</a>
            </#if>
            
            <div class="span11">
              <h4>Ссылки и обзоры: </h4>
              <div style="font-size: 14px;">
                <#noescape>${gun.links!}</#noescape>
              </div>
              
              <div>&nbsp;</div>
            </div>            
            
            <div class="" style="text-align: center;">
              <h4 style="margin-top:0px; margin-bottom: 50px;"><a href="${gun.shopLink}&${partnerKey}" target="_blank">Посмотреть в магазине</a>&nbsp;|&nbsp;<a href="<@spring.url '/' />">Вернуться на главную</a></h4>
            </div>            
          </div>
        </div>
        
        <#if securityService.currentPrincipal == 'admin'>
          <a href="<@spring.url '/admin/new' />">Добавить</a>
        </#if>
      </div>        
    </section>
  </#assign>
</@ui.composition>
